package com;

import com.nlf.calendar.Lunar;

import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.Calendar;

public class test {

    public static void main(String[] args) {
//        Calendar today = Calendar.getInstance();
//        LunarCalendar lunar = LunarCalendar.solar2Lunar(today);
//        System.out.println(lunar.getLyear() + " " + lunar.getLmonth() + " " + lunar.getLdate());
//
//        Calendar solar = LunarCalendar.lunar2Solar(lunar.getLyear(), lunar.getLmonth(), lunar.getLdate(), lunar.isLeapMonth());
//        System.out.println(solar.get(Calendar.YEAR) + " " + solar.get(Calendar.MONTH) + 1 + " " + solar.get(Calendar.DATE));
        main2(args);
    }

    public static void main1(String[] args){
        //今天
        //Lunar date = new Lunar();

        //指定阴历的某一天
        Lunar date = new Lunar(2025,6,30);
        System.out.println(date.getSolar());
    }

    public static void main2(String[] args){
        LocalDateTime dateTime1 = LocalDateTime.of(2023, 5, 15, 14, 30, 30);
        LocalDateTime dateTime2 = LocalDateTime.of(2023, 5, 15, 14, 31, 40);

// 计算相差的天数
        long daysBetween = ChronoUnit.DAYS.between(dateTime1, dateTime2);

// 计算相差的小时数
        long hoursBetween = ChronoUnit.HOURS.between(dateTime1, dateTime2);

// 计算相差的分钟数
        long minutesBetween = ChronoUnit.MINUTES.between(dateTime1, dateTime2);

        long minutesBetweenc =  ChronoUnit.SECONDS.between(dateTime1, dateTime2);

        System.out.println( + daysBetween + " /"+hoursBetween+"/"+minutesBetween+"/"+minutesBetweenc);
    }
}
